//package com.tgky.ybzb.config;
//
//import org.neo4j.driver.AuthTokens;
//import org.neo4j.driver.Driver;
//import org.neo4j.driver.GraphDatabase;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Scope;
//import org.springframework.context.annotation.ScopedProxyMode;
//
//import javax.annotation.PreDestroy;
//
///**
// * @author Lixx
// * @date 2024/9/4 14:22
// */
//
//
//@Configuration
//public class Neo4JConfig {
//    @Value("${spring.neo4j.uri}")
//    private String uri;
//
//    @Value("${spring.neo4j.authentication.username}")
//    private String user;
//
//    @Value("${spring.neo4j.authentication.password}")
//    private String password;
//
//    @Bean(destroyMethod = "close")
//    @Scope(value = "singleton", proxyMode = ScopedProxyMode.TARGET_CLASS)
//    public Driver graphDatabaseDriver() {
//        Driver driver= GraphDatabase.driver(uri, AuthTokens.basic(user, password));
//        System.out.println("Neo4j已连接");
//        return driver;
//    }
//
//    @PreDestroy
//    public void onDestroy() {
//        // 实际上，当Spring容器关闭时，由于我们指定了destroyMethod为"close"，所以这里不需要做任何事情
//        // 这只是为了展示你可以在@PreDestroy注解的方法中执行清理操作
//    }
//
//}
